* REPLICATION DATA
* 2018 CCES MODULE

svyset [pweight=weight]

* Table 2: Optimism and Political Engagement, 2018 CCES
svy: ologit folpol optimism pid spid educ female black latino age
svy: nbreg newsuse optimism pid spid educ female black latino age 
svy: regress ineff optimism pid spid educ female black latino age 
svy: regress exeff optimism pid spid educ female black latino age 
svy: logit vvoted optimism pid spid educ female black latino age 
svy: nbreg pactup optimism pid spid educ female black latino age 

* Table 4: Optimism and Trust, 2018 CCES
svy: logit strust optimism pid spid educ female black latino age
svy: ologit tcamp optimism pid spid educ female black latino age
svy: regress gtrust optimism pid spid educ female black latino age


* SUPPLEMENTAL APPENDIX
********************************************************************************

* Figure A2: Histogram of Optimism, 2018 CCES
histogram optimism, bin(25)

* Table A3: Eigenvalues from Factor Analysis of Optimism and Pessimism Items
* Table A4: Item Loadings from Factor Analysis
factor opt1 opt2 opt3 pess1 pess2 pess3
factor opt1 opt2 opt3 pess1 pess2 pess3, pcf

* Table A7: Correlation Matrix, Optimism and Dependent Variables, 2018 CCES
corr_svy optim folpol newsuse ineff exeff vvoted pactup strust tcamp gtrust [pweight=weight]

* Table A8: Correlation Matrix, Optimism and Control Variables, 2018 CCES
corr_svy optim pid spid educ female black latino age [pweight=weight]

* Table A9: Optimism, Knowledge, and Accuracy, 2018 CCES and 2008 CCAP
svy: logit clearsol optimism pid spid educ female black latino age
svy: logit ownwins optimism pid spid educ female black latino age
svy: regress adunem optimism pid spid educ female black latino age
svy: logit unemacc optimism pid spid educ female black latino age
nbreg kpknow optimism pid spid educ female black latino age [pweight=weight]

* Table A11: Optimism and Political Engagement, 2018 CCES, Regression Estimates
svy: regress folpol optimism pid spid educ female black latino age
svy: regress newsuse optimism pid spid educ female black latino age 
svy: regress ineff optimism pid spid educ female black latino age 
svy: regress exeff optimism pid spid educ female black latino age 
svy: regress vvoted optimism pid spid educ female black latino age
svy: regress pactup optimism pid spid educ female black latino age 

* Table A13: Optimism and Trust, 2018 CCES, Regression Estimates
svy: regress strust optimism pid spid educ female black latino age
svy: regress gtrust optimism pid spid educ female black latino age
svy: regress tcamp optimism pid spid educ female black latino age

* Table A14: Optimism, Knowledge, and Accuracy, 2018 CCES, Regression Estimates
svy: regress clearsol optimism pid spid educ female black latino age
svy: regress ownwins optimism pid spid educ female black latino age
svy: regress adunem optimism pid spid educ female black latino age
svy: regress unemacc optimism pid spid educ female black latino age
svy: regress kpknow optimism pid spid educ female black latino age

* Table A15: Predicted Outcomes at Low and High Levels of Trait Optimism
* based on the following post-estimation command 
margins, at(optimism=(0(1)1)) atmeans

* Table A16: Effects of a Standard Deviation's Increase in Optimism on Predicted Outcomes
* based on the following post-estimation command 
margins, at(optimism=(0.591(0.203)0.794)) atmeans

* Table A21: Optimism and Life Events, 2018 CCES
svy: regress optimism anyneg anypos pid spid educ female black latino age
svy: regress optimism poslev neglev pid spid educ female black latino age
svy: regress optimism lemarried ledivorce lechild lefinsch lenewjob lejobloss leraise leretire leticket lecrimevic leervisit  pid spid educ female black latino age
